from flask import request, jsonify

from info.models import AdminUser




def to_court(court):
    data = {
        "name":court.name,
        "score":court.score
    }
    if court.childs:
        data["childs"] = to_courts(court.childs)
    return data

def to_courts(courts):
    r_courts = []
    for court in courts:
        r_courts.append(to_court(court))
    return r_courts




